package nl.jjsoft.airlock.utils
{
	public class StringUtils
	{
		public function StringUtils(){}

		public static function truncateString(input:String, maxLength:Number, truncRight:Boolean=true, trunc:String="..."):String {
			
			if (input == null || trunc == null) { return input; }
			
			var l:Number = input.length;
			var tl:Number = trunc.length;
			if (l < maxLength) { return input; }
			else {
				if (truncRight){
					return input.substr(0, maxLength-tl).concat(trunc);
				}	
				else {
					return trunc.concat(input.substr(l-(maxLength-tl)));
				}
			} 
		}
				
	}
}